package com.c2soft.nepalcmx.controller;

import java.text.ParseException;
import java.util.List;






import javax.servlet.http.HttpServletRequest;

import lombok.extern.log4j.Log4j2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.c2soft.nepalcmx.command.NetPositionCommand;
import com.c2soft.nepalcmx.services.NetPositionService;
import com.c2soft.nepalcmx.services.ProfitLossService;


@Log4j2
@Controller
public class ProfitLossController {
	
	@Autowired
	private ProfitLossService profitLossService;
	
	@RequestMapping(value = "/ProfitLoss",method=RequestMethod.GET, headers = "Accept=application/json")
	
	public @ResponseBody List<NetPositionCommand> ProfitLoss(@RequestParam("userId") String userId)
	{
			List<NetPositionCommand> profitLoss=profitLossService.getProfitLoss(userId);
		return profitLoss;
		
	}
@RequestMapping(value = "/ProfitLossUser",method=RequestMethod.GET, headers = "Accept=application/json")
	
	public @ResponseBody List<NetPositionCommand> ProfitLossUser(HttpServletRequest req)
	{
	String userId=(String) req.getSession().getAttribute("UsrId");
	
			List<NetPositionCommand> profitLoss=profitLossService.getProfitLoss(userId);
		return profitLoss;
		
	}
	
@RequestMapping(value = "/ProfitLoss1",method=RequestMethod.GET, headers = "Accept=application/json")
	
	public @ResponseBody List<NetPositionCommand> ProfitLoss1(@RequestParam("brokerId") String brokerId)
	{
			List<NetPositionCommand> profitLoss=profitLossService.getBrokerProfitLoss(brokerId);
		return profitLoss;
		
	}
@RequestMapping(value = "/ProfitLoss2",method=RequestMethod.GET, headers = "Accept=application/json")

public @ResponseBody List<NetPositionCommand> ProfitLoss2()
{
		List<NetPositionCommand> profitLoss=profitLossService.getExchangeProfitLoss();
	return profitLoss;
	
}

}
